home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
hity wydania
/
trueSpace 7.6
/
tS761B8Std.exe
/
{app}
/
Scripts
/
MaterialEditor
/
Bricks
/
Compound
/
PhongTS.Brick.xml
< prev
next >
Wrap
Extensible Markup Language
|
2008-06-10
|
2KB
|
32 lines
<?xml version="1.0" encoding="utf-8" ?>
<ME_BRICK GUID="{4CEA0D51-CE86-4F9D-8301-8AF680F50EC8}" Name="RtTSPhong" GUIName="TS Phong Lighting" Description="The phong lighting model for trueSpace transfer">
<ME_BRICK_INPUTPARAM GUID="{9278CE24-116C-45E5-9EE2-7CCC6686B983}" Name="DiffuseStrength" Type="RtFloat"/>
<ME_BRICK_INPUTPARAM GUID="{10BE32CC-1F0F-4BA9-8BF0-F9351D114BA6}" Name="DiffuseColor" Type="RtFloat4"/>
<ME_BRICK_INPUTPARAM GUID="{66823E43-0404-4883-A429-0A68ABC667CF}" Name="SpecularStrength" Type="RtFloat"/>
<ME_BRICK_INPUTPARAM GUID="{738AD189-5EFC-4DB7-93BF-0F20F2185C9F}" Name="Shininess" Type="RtFloat"/>
<ME_BRICK_INPUTPARAM GUID="{9BDA47C6-5953-4E24-914E-3A5D41192446}" Name="NormalVector" Type="RtFloat3"/>
<ME_BRICK_INPUTPARAM GUID="{4C85B9DD-ADA5-48DE-B50B-A65F2DA95A9D}" Name="EyeVector" Type="RtFloat3"/>
<ME_BRICK_INPUTPARAM GUID="{C8CCD12B-8898-465F-A92A-A879CCDDA26A}" Name="LightVector" Type="RtFloat3"/>
<ME_BRICK_INPUTPARAM GUID="{953CD223-1EBB-4508-8D24-E9A0CC856FCA}" Name="LightColor" Type="RtFloat4"/>
<ME_BRICK_OUTPUTPARAM GUID="{EF5316D8-6022-4518-848E-EC74ECD990CA}" Name="ResultColor" Type="RtFloat4"/>
<ME_BRICK_CODE><![CDATA[
//The phong lighting function for TS
void RtTSPhong(in RtFloat DiffuseStrength, in RtFloat4 DiffuseColor, in RtFloat SpecularStrength,
in RtFloat Shininess, in RtFloat3 NormalVector, in RtFloat3 EyeVector, in RtFloat3 LightVector,
in RtFloat4 LightColor, out RtFloat4 ResultColor)
{
ResultColor = RtFloat4(0,0,0,0);
RtFloat DiffuseCoef = rtx_Dot(NormalVector, LightVector);
if (DiffuseCoef>0)
{
RtFloat3 vLightReflect = rtx_Reflect(rtx_Negate(LightVector), NormalVector);
RtFloat EyeDotReflect = rtx_Saturate(rtx_Dot(EyeVector, vLightReflect));
RtFloat SpecularCoef = rtx_Pow(EyeDotReflect, Shininess) * SpecularStrength;
RtFloat4 DiffuseCol = DiffuseStrength * DiffuseCoef * DiffuseColor;
ResultColor.rgb = (DiffuseCol + SpecularCoef) * LightColor;
}
ResultColor.a = DiffuseColor.a;
}
]]></ME_BRICK_CODE>
</ME_BRICK>